﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace peonwar
{
        [Serializable]
    class UnitLight3 : Unit
    {
        // ---CONSTRUCTORS---
        // Creation de l'unite en precisant l'instance du joueur "User"
        public UnitLight3(User player) : base()
        {
            // Caracteristique au type d'unité
            UnitType = 3;
            QueueOffset = 45;

            Initialize(player);
        }

        // ---PROPERTIES---
        // ---METHODES---
        // Animation idle qui joue en boucle
        public override void AnimationIdle()
        {
            base.AnimationIdle();
            Texture = GameTexture.TextureUnitLight3[0];
            Imgwidth = 32;
            Imgheight = 38;
            Indexmax = 5;

            Offset = 0;
        }

        // Animation walk qui est jouer en boucle une fois lancer
        public override void AnimationWalk()
        {
            base.AnimationWalk();
            Texture = GameTexture.TextureUnitLight3[1];
            Imgwidth = 26;
            Imgheight = 40;
            Indexmax = 11;

            Offset = 0;
        }

        // Animation degain de l'arme qui lance ensuite l'animation tirer
        public override void AnimationDrawIn()
        {
            base.AnimationDrawIn();
            Texture = GameTexture.TextureUnitLight3[2];
            Imgwidth = 46;
            Imgheight = 44;
            Indexmax = 6;

            Offset = 10;
        }

        // Animation tirer joue en boucle
        public override void AnimationFire()
        {
            base.AnimationFire();
            Texture = GameTexture.TextureUnitLight3[3];
            Imgwidth = 60;
            Imgheight = 38;
            Indexmax = 3;

            Offset = 16;
        }

        // Animation rengainer l'arme qui lance ensuite l'animation marcher
        public override void AnimationDrawOut()
        {
            base.AnimationDrawOut();
            Texture = GameTexture.TextureUnitLight3[4];
            Imgwidth = 44;
            Imgheight = 47;
            Indexmax = 5;

            Offset = 10;
        }

        // Animation mourrir, pas besoin de l'expliquer
        public override void AnimationDie()
        {
            base.AnimationDie();
            switch (Game.CurrentGame.Online ? 0 : random.Next(0, 3)) // mettre de 0 a 2 apres la soutenance
            {
                case (0):
                    Texture = GameTexture.TextureUnitLight3[5];
                    Imgwidth = 68;
                    Imgheight = 39;
                    Indexmax = 6;

                    Offset = -20; break;
                case (1):
                    if (SettingManager.CurrentProfil.Blood)
                    {
                        Texture = GameTexture.TextureUnitLight3[6];
                        Imgwidth = 47;
                        Imgheight = 45;
                        Indexmax = 14;

                        Offset = 8; break;
                    }
                    else
                    {
                        Texture = GameTexture.TextureUnitLight3[7];
                        Imgwidth = 40;
                        Imgheight = 37;
                        Indexmax = 10;

                        Offset = 0; break;
                    }
                case (2):
                    Texture = GameTexture.TextureUnitLight3[7];
                    Imgwidth = 40;
                    Imgheight = 37;
                    Indexmax = 10;

                    Offset = 0; break;
            }
        }
    }
}
